import { ResponseCode } from "./../../enum/appEnum";
import Mock from "mockjs2";
import { builder, getBody } from "../util";

const truthData = [
  [
    {
      menuId: "1800",
      parentId: null,
      title: "子系统0001-u",
      name: "子系统0001-u",
      icon: "/test/test/0002.jpg",
      menuOrder: "0",
      children: [
        {
          menuId: "1801",
          parentId: "1800",
          title: "微应用0001",
          name: "微应用0001",
          icon: null,
          menuOrder: "0",
          children: [
            {
              menuId: "1802",
              parentId: "1801",
              title: "菜单0001-up",
              name: "菜单0001-up",
              icon: "/test/test/0002.jpg",
              menuOrder: "0",
              children: null,
              menuCode: "test_menu_0001-up",
              menuDesc: null,
              isLeaf: "1",
              path: "/help",
              tenantId: "default",
              funcCode: "M11_BZ",
              serverId: "test0001",
              rediret: null,
            },
          ],
          menuCode: "test_app_0001",
          menuDesc: null,
          isLeaf: "0",
          path: null,
          tenantId: "default",
          funcCode: null,
          serverId: null,
          rediret: null,
        },
      ],
      menuCode: "test_sys_0001-u",
      menuDesc: null,
      isLeaf: "0",
      path: null,
      tenantId: "default",
      funcCode: null,
      serverId: null,
      rediret: null,
    },
  ],
  [
    {
      menuId: "1803",
      parentId: null,
      title: "子系统0002",
      name: "子系统0002",
      icon: "/test/test/0002.jpg",
      menuOrder: "0",
      children: [
        {
          menuId: "1804",
          parentId: "1803",
          title: "微应用0002",
          name: "微应用0002",
          icon: "/test/test/0001.jpg",
          menuOrder: "0",
          children: [
            {
              menuId: "1805",
              parentId: "1804",
              title: "菜单0002",
              name: "菜单0002",
              icon: "/test/test/0002.jpg",
              menuOrder: "0",
              children: null,
              menuCode: "1805",
              menuDesc: null,
              isLeaf: "1",
              path: "/help",
              tenantId: "default",
              funcCode: "M11_BZ",
              serverId: "test0001",
              rediret: null,
            },
          ],
          menuCode: "test_app_0002",
          menuDesc: null,
          isLeaf: "0",
          path: null,
          tenantId: "default",
          funcCode: null,
          serverId: null,
          rediret: null,
        },
        {
          menuId: "1806",
          parentId: "1803",
          title: "微应用0003",
          name: "微应用0003",
          icon: "/test/test/0003.jpg",
          menuOrder: "1",
          children: null,
          menuCode: "test_app_0003",
          menuDesc: null,
          isLeaf: "0",
          path: null,
          tenantId: "default",
          funcCode: null,
          serverId: null,
          rediret: null,
        },
        {
          menuId: "1807",
          parentId: "1803",
          title: "微应用0004",
          name: "微应用0004",
          icon: "/test/test/0004.jpg",
          menuOrder: "2",
          children: null,
          menuCode: "test_app_0004",
          menuDesc: null,
          isLeaf: "0",
          path: null,
          tenantId: "default",
          funcCode: null,
          serverId: null,
          rediret: null,
        },
        {
          menuId: "1808",
          parentId: "1803",
          title: "微应用0005",
          name: "微应用0005",
          icon: "/test/test/0005.jpg",
          menuOrder: "2",
          children: null,
          menuCode: "test_app_0005",
          menuDesc: null,
          isLeaf: "0",
          path: null,
          tenantId: "default",
          funcCode: null,
          serverId: null,
          rediret: null,
        },
      ],
      menuCode: "test_sys_0002",
      menuDesc: null,
      isLeaf: "0",
      path: null,
      tenantId: "default",
      funcCode: null,
      serverId: null,
      rediret: null,
    },
  ],
];

const testData = [
  [
    {
      isLeaf: "0",
      title: "二级管理门户",
      menuCode: "tenantManagement",
      path: "/app/ceshi3",
      redirect: "/app/ceshi3/sysManagement",
      menuOrder: "0",
      icon: "appstore-filled",
      menuDesc: null,

      menuId: "1800",
      parentId: null,
      name: "子系统0001-u",
      tenantId: "default",
      funcCode: null,
      serverId: null,
      children: [
        {
          isLeaf: "0",
          title: "系统管理",
          menuCode: "sysManagement",
          path: "/app/ceshi3/sysManagement",
          redirect: "/app/ceshi3/sysManagement/menuConfig",
          menuOrder: "0",
          icon: "SmileOutlined",
          menuDesc: null,

          menuId: "1801",
          parentId: "1801",
          name: "微应用0001",
          tenantId: "default",
          funcCode: null,
          serverId: null,
          children: [
            {
              isLeaf: "1",
              title: "子系统配置",
              menuCode: "menuConfig",
              path: "/app/ceshi3/sysManagement/menuConfig",
              // redirect: "/app/ceshi3/crud",
              menuOrder: "0",
              icon: "SmileOutlined",
              menuDesc: "菜单权限配置页面",

              menuId: "1802",
              parentId: "1801",
              name: "help",
              children: null,
              tenantId: "default",
              funcCode: "M11_BZ",
              serverId: "test0001",
            },
          ],
        },

        {
          isLeaf: "0",
          title: "角色与权限",
          menuCode: "rolePermission",
          path: "/app/ceshi3/rolePermission",
          redirect: "/app/ceshi3/rolePermission/roleConfig",
          menuOrder: "0",
          icon: "SmileOutlined",
          menuDesc: null,

          menuId: "1803",
          parentId: "1800",
          name: "微应用0001",
          tenantId: "default",
          funcCode: null,
          serverId: null,
          children: [
            {
              isLeaf: "1",
              title: "角色权限配置",
              menuCode: "roleConfig",
              path: "/app/ceshi3/rolePermission/roleConfig",
              // redirect: "/app/vue/home",
              menuOrder: "0",
              icon: "SmileOutlined",
              menuDesc: "角色权限配置页面",

              menuId: "1804",
              parentId: "1801",
              name: "help",
              children: null,
              tenantId: "default",
              funcCode: "M11_BZ",
              serverId: "test0001",
            },
          ],
        },
        {
          isLeaf: "0",
          title: "其它页面",
          menuCode: "other",
          path: "/app/vue2",
          redirect: "/app/vue2/home",
          menuOrder: "0",
          icon: "SmileOutlined",
          menuDesc: null,

          menuId: "1805",
          parentId: "1800",
          name: "微应用0001",
          tenantId: "default",
          funcCode: null,
          serverId: null,
          children: [
            {
              isLeaf: "1",
              title: "Vue2页面",
              menuCode: "other_home",
              path: "/app/vue2/home",
              // redirect: "/app/vue/home",
              menuOrder: "0",
              icon: "SmileOutlined",
              menuDesc: "Vue2 Home",

              menuId: "1806",
              parentId: "1801",
              name: "help",
              children: null,
              tenantId: "default",
              funcCode: "M11_BZ",
              serverId: "test0001",
            },
          ],
        },
      ],
    },
  ],
];

const menuQueryData = () => {
  const data = testData;
  return builder(data, "", ResponseCode.success, {
    "Custom-Header": Mock.mock("@guid"),
  });
};

Mock.mock(/\/authManage000\/selectMenu.xops/, "post", menuQueryData);

Mock.mock(/\/authManage000\/getEmployee.xops/, "post", {
  "code": "777",
  "msg": "成功",
  "datas": [
    {
      "empid": 301907,
      "empcode": "301907",
      "operatorid": 301907,
      "userid": "301907",
      "empname": "朱榕榕",
      "realname": null,
      "gender": null,
      "birthdate": null,
      "position": null,
      "empstatus": null,
      "cardtype": null,
      "cardno": null,
      "indate": null,
      "outdate": null,
      "otel": null,
      "oaddress": null,
      "ozipcode": null,
      "oemail": null,
      "faxno": null,
      "mobileno": null,
      "qq": null,
      "htel": null,
      "haddress": null,
      "hzipcode": null,
      "pemail": null,
      "party": null,
      "degree": null,
      "sortno": null,
      "major": null,
      "specialty": null,
      "workexp": null,
      "regdate": null,
      "createtime": "2015-07-04T16:00:00.000+00:00",
      "lastmodytime": "2015-07-04T16:00:00.000+00:00",
      "orgidlist": null,
      "orgid": 1838,
      "remark": null,
      "tenantId": "default",
      "appId": null,
      "weibo": null
    }
  ],
  "pageIndex": "1",
  "pageSize": "20",
  "total": "1"
});

Mock.mock(/\/orgOgnization\/queryOrgSets.xops/, "post", {
  "code": "777",
  "msg": "成功",
  "datas": [
    {
      "setId": "1",
      "setName": "默认机构",
  },
   {
    "setId": "2",
    "setName": "测试机构",
   }
  ],
  "pageIndex": "1",
  "pageSize": "20",
  "total": "1",
});

// /authManage000/selectRole.xops
Mock.mock(/\/authManage000\/selectRole.xops/, "post", {
  "code": "777",
  "msg": "成功",
  "datas": [
    {
      "apiId": "jzzy1",
      "apiName": "测试一权限点",
  },
   {
    "apiId": "cspt1",
    "apiName": "测试二权限点",
   }
  ],
  "pageIndex": "1",
  "pageSize": "10",
  "total": "2",
});

Mock.mock(/\/orgOgnization\/deleteMultOrg.xops/, "post", {
  code: "777",
  msg: "成功",
  datas: "",
});

Mock.mock(/\/orgOgnization\/addMultOrg.xops/, "post", {
  code: "777",
  msg: "成功",
  datas: "",
});